//// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
//package com.linqingying.gitcode.pullrequest.ui.details.action
//
//import com.intellij.collaboration.async.combineAndCollect
//import com.intellij.collaboration.messages.CollaborationToolsBundle
//import com.intellij.openapi.project.Project
//import kotlinx.coroutines.CoroutineScope
//import kotlinx.coroutines.launch
//import com.linqingying.gitcode.pullrequest.GCPRAction
//import com.linqingying.gitcode.pullrequest.GCPRStatisticsCollector
//import com.linqingying.gitcode.pullrequest.ui.details.model.GCPRReviewFlowViewModel
//import java.awt.event.ActionEvent
//import javax.swing.AbstractAction
//import javax.swing.JButton
//
//internal class GCPRCommitMergeAction(scope: CoroutineScope, private val project: Project, private val reviewFlowVm: GCPRReviewFlowViewModel)
//  : AbstractAction(CollaborationToolsBundle.message("review.details.action.merge")) {
//
//  init {
//    scope.launch {
//      combineAndCollect(reviewFlowVm.isBusy, reviewFlowVm.isMergeEnabled) { isBusy, isMergeEnabled ->
//        isEnabled = !isBusy && isMergeEnabled
//      }
//    }
//  }
//
//  override fun actionPerformed(e: ActionEvent?) {
//    GCPRStatisticsCollector.logDetailsActionInvoked(project, GCPRAction.MERGE, e?.source is JButton)
//    reviewFlowVm.mergeReview()
//  }
//}
